package com.itbupt.infrastructure.persistent.dao;

import cn.bugstack.middleware.db.router.annotation.DBRouter;
import cn.bugstack.middleware.db.router.annotation.DBRouterStrategy;
import com.itbupt.infrastructure.persistent.po.RaffleActivityOrder;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @Author dingchang
 * @Date 2025/3/30 15:49
 * @Description: 抽奖活动单Dao
 */

@Mapper
@DBRouterStrategy(splitTable = true)
public interface IRaffleActivityOrderDao {

    /**
     * 新建一条抽奖活动下单记录
     * @param raffleActivityOrder
     */
    @DBRouter(key = "userId")
    void insert(RaffleActivityOrder raffleActivityOrder);


    @DBRouter
    List<RaffleActivityOrder> queryRaffleActivityOrderByUserId(String userId);

    /**
     * 查询抽奖活动单
     * @param raffleActivityOrderReq
     * @return
     */
    @DBRouter
    RaffleActivityOrder queryRaffleActivityOrder(RaffleActivityOrder raffleActivityOrderReq);

    /**
     * 更新活动订单状态为 completed
     * @param raffleActivityOrderReq
     * @return
     */
    int updateOrderCompleted(RaffleActivityOrder raffleActivityOrderReq);

    // 查询一个月内未支付的活动订单
    @DBRouter
    RaffleActivityOrder queryUnpaidActivityOrder(RaffleActivityOrder raffleActivityOrderReq);

}
